home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 April / Software of the Month Club 1996 April.iso / pc / os2 / psutils / cmd / fixtpps.cmd < prev    next >
Encoding:
Text File  |  1996-02-21  |  695 b   |  31 lines

  1. extproc perl5 -x
  2. #! perl5
  3.  
  4. # fixtpps: fix tpscript document to work with PSUtils
  5. #
  6. # Copyright (C) Angus J. C. Duggan 1991-1995
  7. # See file LICENSE for details.
  8.  
  9. $nesting = 0;
  10. $header = 1;
  11.  
  12. while (<>) {
  13.    if (/^%%Page:/ && $nesting == 0) {
  14.       print $_;
  15.       print "save home\n";
  16.       $header = 0;
  17.    } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
  18.       print $_;
  19.       $nesting++;
  20.    } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
  21.       print $_;
  22.       $nesting--;
  23.    } elsif (/save home/) {
  24.       s/save home//;
  25.       print $_;
  26.    } elsif (!$header || (! /^save$/ && ! /^home$/)) {
  27.       print $_;
  28.    }
  29. }
  30. # End of Script
  31.